/*
 * 版权所有 (c) 2022-2099 TBIT。保留所有权利。
 */

package com.tbit.main.controller;

import com.tbit.common.entity.TempPowerCheckResult;
import com.tbit.main.common.JsonResult;
import com.tbit.main.pojo.VO.TempPowerCheckReqVO;
import com.tbit.main.pojo.VO.TempPowerOnReqVO;
import com.tbit.main.service.TempPowerService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 临时通电
 *
 * @author yao
 * @since 2024/7/4 16:30
 */
@RestController
@RequestMapping("/tempPower")
@Validated
public class TempPowerController {

    @Resource
    private TempPowerService tempPowerService;

    /**
     * 检查是否允许临时通电
     */
    @GetMapping("/check")
    public JsonResult<TempPowerCheckResult> checkTempPower(@Valid TempPowerCheckReqVO reqVO) {
        return JsonResult.succ(tempPowerService.checkTempPower(reqVO));
    }

    /**
     * 临时通电
     */
    @PostMapping("/powerOn")
    public JsonResult<Integer> powerOn(@Valid TempPowerOnReqVO reqVO) {
        tempPowerService.powerOn(reqVO);
        return JsonResult.succ();
    }

}
